<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<label id="text"></label>
	</body>
	<script type="text/javascript">
		function Get1(){
			var ajax = new XMLHttpRequest();
			ajax.open('GET','http://poetry.apiopen.top/sentences');
			ajax.send();
			ajax.onreadystatechange = function(){
				if(ajax.status == 200 && ajax.readyState==4){
					var obj = JSON.parse(ajax.responseText);
					console.log(obj.result);
					document.getElementById('text').innerHTML =  obj.result.from+"<br /> "+obj.result.name;
					JSON.stringify(obj.result);
					 // obj.result.from+" "+obj.result.name;
					console.log(obj.code);
					console.log(obj.message);
				}
			}
		}
		function Get2(){
			var ajax = new XMLHttpRequest();
			ajax.open('GET','http://poetry.apiopen.top/poetryFull?count=2&page=1');
			ajax.send();
			ajax.onreadystatechange = function(){
				if(ajax.status == 200 && ajax.readyState==4){
					var obj = JSON.parse(ajax.responseText);
					console.log(obj.result);
					console.log(obj.code);
					console.log(obj.message);
				}
			}
		}

		function Get3(){
			var ajax = new XMLHttpRequest();
			ajax.open('GET','http://poetry.apiopen.top/getTime');
			ajax.send();
			ajax.onreadystatechange = function(){
				if(ajax.status == 200  && ajax.readyState == 4){
						var obj = JSON.parse(ajax.responseText);
						for(x in obj.result){
							console.log(x);

						}
				}
			}
		}
		
		function Post1(){
			var ajax = new XMLHttpRequest();
			ajax.open('POST','http://poetry.apiopen.top/poetryFull');
			ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
			ajax.send('page=1&count=5');
			ajax.onreadystatechange=function(){
				if(ajax.status == 200 && ajax.readyState == 4){
					var obj = JSON.parse(ajax.responseText);
					console.log(obj.result);
					
					// var arr = new Array();
					// arr = obj.result;
					document.getElementById('text').innerHTML = JSON.stringify(obj.result);
				}
			}
			
		}
		
		function Post2(){
			var ajax = new XMLHttpRequest();
			// ajax.open('POST','https://api.apiopen.top/userFeedback');
			// ajax.setRequestHeader('Cintent-type','application/x-www-form-urlencoded');
			// var data = 'apikey=9648872f9aa08da137ce45fe1dda8279&text=ac&email=135@qq.com';
			// console.log(data)
			// ajax.send(data);
			// if(ajax.status == 200 && ajax.readyState == 4){
			// 	var obj = JSON.parse(ajax.responseText);
			// 	console.log(obj.result);
			
			ajax.open('POST','https://api.apiopen.top/developerLogin');
			ajax.setRequestHeader('Cintent-type','application/x-www-form-urlencoded');
			ajax.send('name=Polyhymnia&passwd=123456');
			if(ajax.status ==200 && ajax.readyState == 4 ){
				var obj = JSON.parse(ajax.responseText);
				console.log(obj.result)
				}
			
		}
		onload = function(){
			Post2();
		}
	</script>
</html>
